class Stack:
    def __init__(self) -> None:
        self._stack = []

    # 压栈：添加元素
    def push(self, value):
        self._stack.append(value)

    # 出栈：删除栈顶元素
    def pop(self):
        assert self.is_empty, "Stack is empty."
        self._stack.pop()

    # 查看栈顶元素
    def get_top(self):
        if self._stack:
            return self._stack[-1]
        else:
            return None

    # 查看栈是否为空
    def is_empty(self):
        return len(self._stack) == 0

    # 查看栈中元素
    def view_element(self):
        print(self._stack)


if __name__ == "__main__":
    stack = Stack()
    stack.push(1)
    stack.push(2)
    print('查看栈顶元素：', stack.get_top())
    print('栈是否为空：', stack.is_empty())
    print('查看栈中元素：')
    stack.view_element()
    stack.pop()
    print('再次查看栈中元素：')
    stack.view_element()
